From 633e3a3d94777440f07ed00a88abc1ac388bb2f0 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 10 Aug 2025 18:53:09 -0700 Subject: authorizations --- src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/routes/(app)/fund/[id]/sweep') diff --git a/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts b/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts index 47dfdaab..78df3461 100644 --- a/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts +++ b/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts @@ -9,15 +9,16 @@ export async function load({ cookies, request, params, parent }) { let [amount, currency] = params.amount.split("/"); if (!currency) currency = user?.currency; + if (currency) currency = currency.toUpperCase(); const rates = await getRates(); - const rate = rates[currency?.toUpperCase() || "USD"]; + const rate = rates[currency || "USD"]; if (currency && !rate) error(500, "Invalid currency symbol"); if (!amount) { const balance = await get(`/fund/${id}`); - amount = balance.amount; + amount = balance.authorization || balance.amount; } else if (currency) { - amount = (amount * sats) / rate; + amount = Math.round((amount * sats) / rate); } const username = randomName() + Math.floor(Math.random() * 99) + 1; -- cgit v1.2.3